package main

import (
	"crypto/md5"
	"encoding/hex"
	"fmt"
)

const (
	key = "__zheyexushiai__"
)

func Md5(data string) string {
	md5 := md5.New()
	md5.Write([]byte(data))
	md5Data := md5.Sum(nil)
	return hex.EncodeToString(md5Data)
}

func GenerateSign(signTime string) string {
	s := fmt.Sprintf("%s%s", key, signTime)
	e := md5.Sum([]byte(s))
	return fmt.Sprintf("%x", e)
}

func GenerateSignX(signTime int) string {
	s := fmt.Sprintf("%s%d", key, signTime)
	e := md5.Sum([]byte(s))
	return fmt.Sprintf("%x", e)
}

func main() {
	fmt.Println(GenerateSign("1505726165"))
	fmt.Println(GenerateSignX(1505726165))
	fmt.Println(Md5("__zheyexushiai__1505726165"))

}
